package test;
import org.apache.commons.mail.SimpleEmail;


/**
 * Created by fusxian on 14-3-27.
 */
public class test01 {
    public static  void main(String[] args)
    {
        System.out.println("test.test01");

        SimpleEmail email = new SimpleEmail();
        email.setHostName("smtp.qq.com");
      email.setAuthentication("870086043", "fuaixue900312");
        email.setCharset("UTF-8");
        try {
            email.addTo("17703823@qq.com");
            email.setFrom("870086043@qq.com");//必须和Authentication使用的用户相同，否则失败
            email.setSubject("O2O平台给您的邮件");
            StringBuilder builder = new StringBuilder();
            builder.append("这是来自O2O平台的测试邮件，不用回复。随机验证码为：123456");
            builder.append("---------------");
            builder.append("http://www.baidu.com");
            email.setMsg(builder.toString());
            email.send();
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("send successfuly!");

    }
}
